package com.hgw.Demo06_CompositePattern.examples;

/**
 * Data time:2021/12/15 16:00
 * StudentID:2019112118
 * Author:hgw
 * Description: 客户端测试类
 */
public class Client {
    public static void main(String[] args) {
        // 针对抽象构建编程
        AbstractFile file1,file2,file3,file4,file5,folder1,folder2,folder3,folder4;

        folder1 = new Folder("Hgw的资料");
        folder2 = new Folder("图像文件");
        folder3 = new Folder("文本文件");
        folder4 = new Folder("视频文件");

        file1 = new ImageFile("迪尼热巴.jpg");
        file2 = new ImageFile("苍老师.png");
        file3 = new TextFile("金品梅.txt");
        file4 = new TextFile("课程设计.doc");
        file5 = new VideoFile("笑傲江湖.rmvb");

        folder2.add(file1);
        folder2.add(file2);
        folder3.add(file3);
        folder3.add(file4);
        folder4.add(file5);

        folder1.add(folder2);
        folder1.add(folder3);
        folder1.add(folder4);

        // 从"Hgw的资料"开始进行杀毒操作
        folder1.killVirus();

    }
}
